from flask import Flask
from flask import render_template
from flask import url_for
from flask import jsonify
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World'



@app.route('/user/<name>')
def username(name):
    return '<h1>hello,%s</h1>' % name


@app.route('/url/')
def redirect_to_url():
    return url_for('post_show',post_id = 666)


@app.route('/post/<int:post_id>')
def show_psot(show_id):
    return 'Post ID : %d' %show_id


@app.route('/getJson')
def getJson():
    data = {
        "name": "张三",
        "sex": "男",
        "age": "18",
        "address": "xxxxxxxxx"
    }
    return jsonify(data)

if __name__ == '__main__':
    app.debug = True
    app.run()